package so.ifl.servcie.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import so.ifl.dao.MenuInfoDao;
import so.ifl.servcie.MenuService;
import so.ifl.vo.MenuVo;

/**
 *create by aaron.lu
 *create at 2011-12-20 下午10:43:04
 *<mailto: atyuan.lu@gmail.com>
 **/
@Service("menuService")
public class MenuServiceImpl implements MenuService {
	
	@Autowired
	private MenuInfoDao menuInfoDao;
	
	/**
	 * 分页查询菜单信息
	 * create by aaron.lu
	 * create at 2011-12-20 下午10:45:54
	 * <mailto: atyuan.lu@gmail.com>
	 * @param param
	 * @param offset
	 * @param limmit
	 * @return
	 *
	 */
	public List<MenuVo> queryMenuWithParamAndPagination(Map<String, Object> param, int offset, int limmit){
		return menuInfoDao.queryMenuWithParamAndPagination(param, new RowBounds(offset, limmit));
	}
	
	/**
	 * 查询菜单信息<无null>
	 * create by aaron.lu
	 * create at 2012-1-15 下午11:06:25
	 * <mailto: atyuan.lu@gmail.com>
	 * @param param
	 * @param offset
	 * @param limmit
	 * @return
	 *
	 */
	public List<MenuVo> queryMenuWithParamAndPaginationNoNull(Map<String, Object> param, int offset, int limmit){
		return menuInfoDao.queryMenuWithParamAndPaginationNoNull(param, new RowBounds(offset, limmit));
	}
	
	/**
	 * 统计菜单信息<无null>
	 * create by aaron.lu
	 * create at 2011-12-20 下午10:47:19
	 * <mailto: atyuan.lu@gmail.com>
	 * @param param
	 * @return
	 *
	 */
	public Integer countMenuWithParamNoNull(Map<String, Object> param){
		return menuInfoDao.countMenuWithParamNoNull(param);
	}
	
	/**
	 * 统计菜单信息
	 * create by aaron.lu
	 * create at 2011-12-20 下午10:47:19
	 * <mailto: atyuan.lu@gmail.com>
	 * @param param
	 * @return
	 *
	 */
	public Integer countMenuWithParam(Map<String, Object> param){
		return menuInfoDao.countMenuWithParam(param);
	}
	
	/**
	 * 新增菜单信息
	 * create by aaron.lu
	 * create at 2011-12-20 下午10:50:14
	 * <mailto: atyuan.lu@gmail.com>
	 * @param menuVo
	 *
	 */
	public void insertMenu(MenuVo menuVo){
		menuInfoDao.insertMenu(menuVo);
	}
	
	/**
	 * 更新菜单信息
	 * create by aaron.lu
	 * create at 2011-12-20 下午10:52:14
	 * <mailto: atyuan.lu@gmail.com>
	 * @param param
	 *
	 */
	public void updateMenu(Map<String, Object> param){
		menuInfoDao.updateMenu(param);
	}
	
	/**
	 * 删除菜单
	 * create by aaron.lu
	 * create at 2011-12-20 下午10:56:01
	 * <mailto: atyuan.lu@gmail.com>
	 * @param menuId
	 *
	 */
	public void deleteMenu(Integer menuId){
		menuInfoDao.deleteMenu(menuId);
	}
	
	/**
	 * 通过权限查询
	 * create by aaron.lu
	 * create at 2012-1-17 上午11:07:16
	 * <mailto: atyuan.lu@gmail.com>
	 * @param param
	 * @param offset
	 * @param limmit
	 * @return
	 *
	 */
	public List<MenuVo> queryMenuWithRole(Map<String, Object> param, int offset, int limmit){
		return menuInfoDao.queryMenuWithRole(param, new RowBounds(offset, limmit));
	}
	
	/**
	 * 通过权限查询
	 * create by aaron.lu
	 * create at 2012-1-17 上午11:09:20
	 * <mailto: atyuan.lu@gmail.com>
	 * @param param
	 * @return
	 *
	 */
	public Integer countMenuWithRole(Map<String, Object> param){
		return menuInfoDao.countMenuWithRole(param);
	}
	
	/**
	 * 通过权限查询
	 * create by aaron.lu
	 * create at 2012-1-17 上午11:07:16
	 * <mailto: atyuan.lu@gmail.com>
	 * @param param
	 * @param offset
	 * @param limmit
	 * @return
	 *
	 */
	public List<MenuVo> queryMenuWithRoleNoRecurrence(Map<String, Object> param, int offset, int limmit){
		return menuInfoDao.queryMenuWithRoleNoRecurrence(param, new RowBounds(offset, limmit));
	}
	
	/**
	 * 通过权限查询
	 * create by aaron.lu
	 * create at 2012-1-17 上午11:09:20
	 * <mailto: atyuan.lu@gmail.com>
	 * @param param
	 * @return
	 *
	 */
	public Integer countMenuWithRoleNoRecurrence(Map<String, Object> param){
		return menuInfoDao.countMenuWithRoleNoRecurrence(param);
	}
}
